home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2444 / 2444.xpi / install.js < prev    next >
Text File  |  2009-12-02  |  3KB  |  67 lines

  1. var linkextendXpiInstaller = {
  2.     extFullName: "FoxLingo",
  3.     extShortName: "foxlingo",
  4.     extVersion: "2.5.2",
  5.     extAuthor: "Linkular LLC",
  6.     extLocaleNames: ['af-ZA', 'ar-SA', 'ca-AD', 'cs-CZ', 'da-DK', 'de-DE', 'es-ES', 'fr-FR', 'gl-ES', 'he-IL', 'id-ID', 'it-IT', 'ja-JP', 'nl-NL', 'pl-PL', 'pt-BR', 'ro-RO', 
  7.                                    'ru-RU', 'zh-TW', 'en-US'],
  8.     extPostInstallMessage: null,
  9.     
  10.     profileInstall: true,
  11.     silentInstall: false,
  12.  
  13.     install: function() {
  14.         if (Install.arguments && (Install.arguments == "p=0" || Install.arguments == "p=1")) {
  15.             this.profileInstall = (Install.arguments == "p=1");
  16.             this.silentInstall = true;
  17.         }        
  18.  
  19.         var jarName = this.extShortName + ".jar";
  20.         var profileDir = Install.getFolder("Profile", "chrome");
  21.  
  22.         if (File.exists(Install.getFolder(profileDir, jarName))) {
  23.             if (!this.silentInstall)
  24.                 Install.alert("Updating existing Profile install of " + this.extFullName + " to version " + this.extVersion + ".");
  25.             this.profileInstall = true;
  26.         } else if (!this.silentInstall)    {
  27.             this.profileInstall = Install.confirm("Install " + this.extFullName + " " + this.extVersion + " to your Profile directory (OK) or your Browser directory (Cancel)?");
  28.         }
  29.         
  30.         Install.initInstall(this.extFullName, this.extShortName, this.extVersion);
  31.         
  32.         var installPath = (this.profileInstall)?profileDir:Install.getFolder("chrome");
  33.         
  34.         Install.addFile(null, "chrome/" + jarName, installPath, null);
  35.         
  36.         var jarPath = Install.getFolder(installPath, jarName);
  37.         var installType = (this.profileInstall)?Install.PROFILE_CHROME:Install.DELAYED_CHROME;
  38.         
  39.         Install.registerChrome(Install.CONTENT | installType, jarPath, "content/");
  40.         
  41.         for (var locale in this.extLocaleNames) {
  42.             var regPath = "locale/" + this.extLocaleNames[locale] + "/" + this.extShortName + "/";
  43.             Install.registerChrome(Install.LOCALE | installType, jarPath, regPath);
  44.         }
  45.         Install.registerChrome(Install.SKIN | installType, jarPath, "skin/");
  46.         
  47.         if (!this.profileInstall) {
  48.             installPath = Install.getFolder("Components");
  49.             for (var comp in this.extComponents) {
  50.                 Install.addFile(null, "components/" + this.extComponents[comp], installPath, null);
  51.             }
  52.         }
  53.  
  54.         var err = Install.performInstall();
  55.         if (err == Install.SUCCESS || err == Install.REBOOT_NEEDED) {
  56.             if (!this.silentInstall && this.extPostInstallMessage)
  57.                 Install.alert(this.extPostInstallMessage);
  58.         } else {
  59.             if (!this.silentInstall) 
  60.                 Install.alert("Error: Could not install " + this.extFullName + " " + this.extVersion + " (Error code: " + err + ")");
  61.             Install.cancelInstall(err);
  62.         }
  63.     }
  64. };
  65.  
  66. linkextendXpiInstaller.install();
  67.